#include "junix.h"
using namespace std;

int main(int argc, char **argv)
{
	srand(time(0));
	vector<int> vi(20);
	using namespace boost;
	generate(vi.begin(),vi.end(),
			bind( modulus<int>(), bind(rand), 20));
	vector<int>::iterator p;
	p=partition(vi.begin(),vi.end(),
			bind( greater<int>(), _1, 5));
	ostream_iterator<int> oit(cout, " ");
	copy(vi.begin(), p, oit);
	cout<<endl;

	generate(vi.begin(),vi.end(),
			boost::bind(modulus<int>(), boost::bind(rand), 20));
	p=stable_partition(vi.begin(),vi.end(),
			boost::bind( greater<int>(), _1, 9));
	copy(vi.begin(),p,oit);
	cout<<endl;

}
